package com.huawei.app.demo.fragment;

import java.util.List;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * 功能描述
 *
 * @since 2021-01-20
 */
public class ContentPagerAdapter extends FragmentPagerAdapter {

    private List<CustomFragment> fragmentList;

    public ContentPagerAdapter(FragmentManager fm, List<CustomFragment> fragmentList) {
        super(fm);
        this.fragmentList = fragmentList;
    }

    @Override
    public Fragment getItem(int i) {
        return fragmentList.get(i);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return fragmentList.get(position).getTitle();
    }
}
